import { DTaroAjax } from '@/http/http'
import http from '@/api/'
import commonUtils from '@/common/'
const order = '/api/cookcar-order'
const orderPath = '/car/stocktaking'

const cookOrder = {
  // 继续盘库
  continuePanku(id) {
    return DTaroAjax(`${order}/car/stocktaking/goOn/${id}`, {}, 'get')
  },
  // 盘库订单完成
  confirmPanku(id) {
    return DTaroAjax(`${order}/car/stocktaking/confirm/${id}`, {}, 'get')
  },
  getInvenLists(params) {
    return DTaroAjax(`${order}/car/stocktaking/getCompanyStocktakings2?status=${params.status}`, {}, 'post')
  },
  stocktakingDeatil(params) {
    return DTaroAjax(`${order}/car/stocktaking/${params.id}`)
  },
  putAppStocktaking(params) {
    return DTaroAjax(`${order}/car/stocktaking/putAppStocktaking`, params, 'post')
  },
  getAppStocktaking(params) {
    return DTaroAjax(`${order}/car/stocktaking/getAppStocktaking?id=${params.id}&id2=${params.id2}`, {}, 'post')
  },
  getImgs(params) {
    return DTaroAjax(`${order}/car/stocktaking/getImgs?date=${params.date}&id=${params.id}`, {}, 'post')
  },
  // 代购申请表
  addAdvanceMoney(params) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/save`, params, 'POST')
  },
  // 代购 库融订单统计
  getOrderNumber() {
    return DTaroAjax(`${order}/applyCount`)
  },
  getTransCar(params) {
    return DTaroAjax(`${order}/order/transCar/`, params, 'GET')
  },

  // 定金担保 车源 寻车
  transCaPayOrder(params) {
    // let   para = JSON.stringify(params)
    // let res = await http.keyInitInit()
    // let paramsEnt =  commonUtils.encryptResult(res,para)
    // ?payIp=${params.payIp}&id=${params.id}&payType=${params.payType}`

    return DTaroAjax(`${order}/order/transCar/payOrder?payIp=${params.payIp}&id=${params.id}&payType=${params.payType}`, {}, 'POST')
  },
  // 承运订单支付
  transPayOrder(params) {
    // let   para = JSON.stringify(params)
    // let res = await http.keyInitInit()
    // let paramsEnt =  commonUtils.encryptResult(res,para)
    // ?payIp=${params.payIp}&id=${params.id}&payType=${params.payType}`

    return DTaroAjax(`${order}/trans/payOrder?payIp=${params.payIp}&id=${params.id}&payType=${params.payType}`, {}, 'POST')
  },

  //保存按揭登记表
  saveRegistration(params) {
    // let   para = JSON.stringify(params)
    // let res = await http.keyInitInit()
    // let paramsEnt =  commonUtils.encryptResult(res,para)
    // ?payIp=${params.payIp}&id=${params.id}&payType=${params.payType}`

    return DTaroAjax(`${order}/mortgage/registration/`, params, 'POST')
  },
  // 重新提交按揭登记表
  replaceSaveReload(params) {
    return DTaroAjax(`${order}/mortgage/registration/saveReload?id=${params.id}`, params, 'POST')
  },

  //app获取我的按揭列表
  appGetList(params) {

    return DTaroAjax(`${order}/mortgage/registration/appGetList`, params, 'GET', false, true, true)
  },

  //app获取车商 按揭列表

  getSearchMortgages(params) {

    return DTaroAjax(`${order}/mortgage/registration/getSearchMortgages`, params, 'GET', false, true, true)
  },
  //取消申请
  cancelApply(params) {
    return DTaroAjax(`${order}/mortgage/registration/cancel?id=${params.id}`, {}, 'POST', 1, 1, 1, 1)
  },
  //app根据当前登录人获取车商列表
  getCarsDealer(params) {
    return DTaroAjax(`${order}/mortgage/registration/getCars`, params, 'GET', 1, 1, 1)
  },
  // app根据当前登录人获取 业务员,中介机构/个人
  getServicer(params) {
    return DTaroAjax(`${order}/mortgage/registration/getServicer`)
  },
  //app获取车商 寻车 车源列表
  getSearchCars(params) {

    // let	data = `?limit=${params.limit}&page=${params.page}&entId=${params.entId}`
    return DTaroAjax(`${order}/mortgage/registration/getSearchCars`, params, 'get', 1, 1, 1)
  },
  //获取按揭登记表信息
  getRegistration(id) {
    return DTaroAjax(`${order}/mortgage/registration/${id}`,)
  },
  //根据车型 外观颜色 获取经销商列表
  getEntList(params) {
    return DTaroAjax(`${order}/mortgage/registration/getEntList?outColor=${params.outColor}&carModelId=${params.carModelId}`, {}, 'POST')
  },
  // 龙存管支付回调
  lcgNotify(params) {
    return DTaroAjax(`${order}/trans/lcgNotify`, params, 'get', false)
  },
  // 获取售车确认退款列表
  pendingRefund() {
    return DTaroAjax(`${order}/order/transCar/pendingRefund`, {}, 'get')
  },
  // 寻车卖家同意撤销接口
  withdrawalOfConsent(orderId) {
    return DTaroAjax(`${order}/order/transCar/withdrawalOfConsent?orderId=${orderId}`, {}, 'post')
  },
  // 物流卖家同意撤销接口
  withdrawalOfConsentTans(orderId) {
    return DTaroAjax(`${order}/trans/withdrawalOfConsent?orderId=${orderId}`, {}, 'post')
  },
  withdrawalOfConsent2(orderId) {
    return DTaroAjax(`${order}/trans/withdrawalOfConsent2?orderId=${orderId}`, {}, 'get')
  },
  // 判断是否确认合同
  buyersConfirm3(id) {
    return DTaroAjax(`${order}/trans/buyersConfirm3?id=${id}`, {}, 'get')
  },
  advanceMoneyApplyPC(id) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/pc/${id}`, {}, 'get')
  },
  getUrlScheme(id, type) {
    return DTaroAjax(`${order}/trans/getPayUrl?id=${id}&type=${type}`, {}, 'get')
  },
  // 获取代购审核列表
  getBuyList(params) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/`, params, 'get')
  },
  // 获取代购详情
  getBuyDetail(id) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/pc/${id}`, {}, 'get')
  },
  // 垫资审批不通过
  MoneyApplyNoPass({ id, auditOpinion }) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/noPass?id=${id}&auditOpinion=${auditOpinion}`, {}, 'put')
  },
  // 审批申请通过
  MoneyApplyPass({ id }) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/pass?id=${id}`, {}, 'put')
  },
  // 财务确认通过
  financePass({ id }) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/financePass?id=${id}`, {}, 'put')
  },
  // 财务确认不通过
  financeNoPass({ id, explain }) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/financeNoPass?id=${id}&explain=${explain}`, {}, 'put')
  },
  // 财务确认打款
  contractConfirm(id) {
    return DTaroAjax(`${order}/car/advanceMoneyApply/contractConfirm?id=${id}`, {}, 'put')
  },
  // 获取按揭审核列表
  getMortgageList(params) {
    return DTaroAjax(`${order}/mortgage/registration/`, params, 'get')
  },
  // 按揭审核详情
  getMortgageDetail(id) {
    return DTaroAjax(`${order}/mortgage/registration/${id}`, {}, 'get')
  },
  // 按揭审核
  updateRegistration(params) {
    return DTaroAjax(`${order}/mortgage/registration/update`, params, 'put', true, true, true)
  },
  // 盘库管理列表
  getStocktakingList(params) {
    return DTaroAjax(`${order}/car/stocktaking/list`, params, 'get')
  },
  // 历史数据迁移, 获取按揭列表
  getMortgageListHis(params) {
    return DTaroAjax(`${order}/history/inquire/mortgageInquire`, params, 'get')
  },
  // 历史数据迁移， 车商汇总
  getAllCarDealer(params) {
    return DTaroAjax(`${order}/history/inquire/carDealerSummary`, params, 'get')
  },
  // 历史数据迁移，全部汇总
  getAllSummary(params) {
    return DTaroAjax(`${order}/history/inquire/allSummary`, params, 'get')
  },
  // 历史数据迁移，垫资及盘库
  getinventoryAdvance(params) {
    return DTaroAjax(`${order}/history/inquire/inventoryAdvance`, params, 'get')
  },
	//按揭统计
	getMortgage(params) {
	  return DTaroAjax(`${order}/statistical/getMortgage`,{},'get')
	},
	//垫资
	getInformation(params) {

	  return DTaroAjax(`${order}/statistical/getInformation`,{},'get')
	},
	//盘库统计
	getStorage(params) {

	  return DTaroAjax(`${order}/statistical/getStorage`,{},'get')
	},
  imageUpload(data, explain = '') {
    return DTaroAjax(`${order}/car/advanceMoneyApply/saveApplyImage?explain=${explain}`, data, 'post')
  },
}
export default cookOrder
